package com.teacold.customdemo.chapter_nine;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;

public class MATRIX_SAVE_FLAG_View extends View {
    private Paint mPaint;

    public MATRIX_SAVE_FLAG_View(Context context) {
        this(context,null);
    }

    public MATRIX_SAVE_FLAG_View(Context context, AttributeSet attrs) {
        this(context, attrs,0);
    }

    public MATRIX_SAVE_FLAG_View(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        setLayerType(LAYER_TYPE_SOFTWARE,null);
        mPaint=new Paint();
        mPaint.setColor(Color.RED);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.saveLayer(new RectF(0,0,100,100),null,Canvas.ALL_SAVE_FLAG);


    }
}
